package org.yaac.client.place;


import com.google.gwt.place.shared.PlaceTokenizer;
import com.google.gwt.place.shared.Prefix;

/**
 * @author Max Zhu (thebbsky@gmail.com)
 *
 */
public class EditorPlace extends YaacPlace {

	/**
	 * 
	 */
	public static final String URL_TOKEN = "editor";
	
	/**
	 * the underlying entity key string
	 */
	private String keyString;
	
	public EditorPlace(String keyString) {
		super();
		this.keyString = keyString;
	}
	
	public String getKeyString() {
		return keyString;
	}

	@Override
	public String urlTokenPrefix() {
		return URL_TOKEN;
	}
	
	/**
	 * @author Max Zhu (thebbsky@gmail.com)
	 *
	 */
	@Prefix(URL_TOKEN)
	public static class Tokenizer implements PlaceTokenizer<EditorPlace> {

		@Override
		public String getToken(EditorPlace place) {
			return place.keyString;
		}

		@Override
		public EditorPlace getPlace(String token) {
			return new EditorPlace(token);
		}
	}
}
